<template lang="html">
  <div>
    <v-header>已购买商品</v-header>
    <v-section1 :list="classList"></v-section1>
    <v-baseline></v-baseline>
  </div>
</template>

<script>
  import Header from '@/common/_header.vue'
  import Baseline from '@/common/_baseline.vue'
  import Footer from '@/common/_footer.vue'
  import Section1 from '@/components/index/section1.vue'
export default {
  components: {
      'v-header': Header,
      'v-baseline': Baseline,
      'v-footer': Footer,
      'v-section1': Section1,
    },
    data() {
      return {
        classList: [],
      }
    },
    created(){
      let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))

      this.$api({
        method: 'get',
        url: '/orderInfo/getMyOrderInfo',
        params: {
          userId: userInfo.data.id
        }
      }).then((res) => {
        let arr = res.data.data.data
        let list = arr.filter((item) => {
          return item.orderStatus == 1
        })
        let arrs = new Array()
        list.forEach(element => {
          arrs.push(element.courseInfo)
        });
        this.classList = arrs
      }).catch((error) => {
        console.log(error)
      })
    }
}
</script>

<style lang="less" scoped>

</style>
